package com.mzy.datepackage.M2021.Dec.tSeven;

import java.util.regex.Pattern;

/**
 * @author Ives
 * * @date 2021/12/27
 */
public class test {
  /**
   * 正则表达式
   * \d匹配一个任意非负整数，\\转义字符
   */
  public static void main(String[] args) {
    String[] a={"123","12.22","1234","0.22","ss","aaaa"};

    for (int i = 0; i < a.length; i++) {
      boolean matches = Pattern.matches("\\d+||(\\d+\\.\\d+)", a[i]);
      if (matches)
        System.out.println(a[i]);
    }

  }
}
